jQuery(function($) {

    var selectedProjectKeeper;

    $('.anchorProject').click(function(event) {
        var anchorId = event.target.id;
        var projectKey = anchorId.substring("anchorProject".length);
        $("#tblProjects tr:not(:first)").css("backgroundColor", "white");
        if (selectedProjectKeeper != projectKey) {
            selectedProjectKeeper = projectKey;
            $("#row" + projectKey).css("backgroundColor", "#6699ff");
            $("#acproProjectKey").val(projectKey);
        } else {
            selectedProjectKeeper = null;
            $("#acproProjectKey").val("");
        }
        return false;
    });

});